import request from '@/utils/request'

// 创建产品分类
export function createItemCategory(data) {
  return request({
    url: '/base/item-category/create',
    method: 'post',
    data: data
  })
}

// 更新产品分类
export function updateItemCategory(data) {
  return request({
    url: '/base/item-category/update',
    method: 'put',
    data: data
  })
}

// 删除产品分类
export function deleteItemCategory(id) {
  return request({
    url: '/base/item-category/delete?id=' + id,
    method: 'delete'
  })
}

// 获得产品分类
export function getItemCategory(id) {
  return request({
    url: '/base/item-category/get?id=' + id,
    method: 'get'
  })
}

// 获得产品分类列表
export function getItemCategoryList(query) {
  return request({
    url: '/base/item-category/list',
    method: 'get',
    params: query
  })
}

// 获得精简产品分类列表
export function getItemCategorySimpleList() {
  return request({
    url: '/base/item-category/list-all-simple',
    method: 'get'
  })
}

// 导出产品分类 Excel
export function exportItemCategoryExcel(query) {
  return request({
    url: '/base/item-category/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
